package lab02.test6;
public class Triangle {
    private double length1 ;
    private double length2 ;
    private double length3 ;
    double grith;
    double area;
    Boolean judge=false;

    Triangle() {
    }

    public Triangle(double length1, double length2, double length3) {
        this.length1 = length1;
        this.length2 = length2;
        this.length3 = length3;
    }

    public double getLength1() {
        return length1;
    }

    public double getLength2() {
        return length2;
    }

    public double getLength3() {
        return length3;
    }

    public void setLength1(double length1) {
        this.length1 = length1;
    }

    public void setLength2(double length2) {
        this.length2 = length2;
    }

    public void setLength3(double length3) {
        this.length3 = length3;
    }

  void judge() {
        double max=0;
        double min=0;
        double mid=0;
      grith=length1+length3+length2;
      area= Math.sqrt(grith/2*(grith/2-length1)*(grith/2-length2)*(grith-length3));
      //三角形任意两边之和大于第三边，任意两边之差小于第三边即最小边与二大边之和大于最小边
      //最大边与最小边之差小于二大边
        max = length1 > length2 ? length1 : length2;
        max = max > length3 ? max : length3;
        min = length1 < length2 ? length1 : length2;
        min = min < length3 ? min : length3;
        mid = length1 > length2 ? length1 : length2;
        mid = mid < length3 ? mid:length3;
       if(max > (mid + min)&&mid>(max-min)){
       judge=true;
       }
       else if(max<=(mid + min)||mid<(max-min)){
           judge=false;
       }
      if(judge==true) {
          System.out.println(judge + " the Triangle grith is "
                  + grith + " area is " + area);
      }
      else {
            System.out.println(false);
        }
    }
}